<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- qpen.cpp -->
  <title>QPen Class | Qt GUI 5.14.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.14</a></td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QPen</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtgui-index.html">Qt 5.14.2 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#pen-style">Pen Style</a></li>
<li class="level2"><a href="#cap-style">Cap Style</a></li>
<li class="level2"><a href="#join-style">Join Style</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QPen Class</h1>
<!-- $$$QPen-brief -->
<p>The QPen class defines how a <a href="qpainter.html">QPainter</a> should draw lines and outlines of shapes. <a href="#details">More...</a></p>
<!-- @@@QPen -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QPen&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr></table></div><ul>
<li><a href="qpen-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#QPen-5">QPen</a></b>(QPen &amp;&amp;<i>pen</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#QPen-4">QPen</a></b>(const QPen &amp;<i>pen</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#QPen-3">QPen</a></b>(const QBrush &amp;<i>brush</i>, qreal <i>width</i>, Qt::PenStyle <i>style</i> = Qt::SolidLine, Qt::PenCapStyle <i>cap</i> = Qt::SquareCap, Qt::PenJoinStyle <i>join</i> = Qt::BevelJoin)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#QPen-2">QPen</a></b>(const QColor &amp;<i>color</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#QPen-1">QPen</a></b>(Qt::PenStyle <i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#QPen">QPen</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPen &amp;</td><td class="memItemRight bottomAlign"><b><a href="qpen.html#operator-eq-1">operator=</a></b>(QPen &amp;&amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPen &amp;</td><td class="memItemRight bottomAlign"><b><a href="qpen.html#operator-eq">operator=</a></b>(const QPen &amp;<i>pen</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#dtor.QPen">~QPen</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBrush </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#brush">brush</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::PenCapStyle </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#capStyle">capStyle</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QColor </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#color">color</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#dashOffset">dashOffset</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVector&lt;qreal&gt; </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#dashPattern">dashPattern</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#isCosmetic">isCosmetic</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#isSolid">isSolid</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::PenJoinStyle </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#joinStyle">joinStyle</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#miterLimit">miterLimit</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#setBrush">setBrush</a></b>(const QBrush &amp;<i>brush</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#setCapStyle">setCapStyle</a></b>(Qt::PenCapStyle <i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#setColor">setColor</a></b>(const QColor &amp;<i>color</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#setCosmetic">setCosmetic</a></b>(bool <i>cosmetic</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#setDashOffset">setDashOffset</a></b>(qreal <i>offset</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#setDashPattern">setDashPattern</a></b>(const QVector&lt;qreal&gt; &amp;<i>pattern</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#setJoinStyle">setJoinStyle</a></b>(Qt::PenJoinStyle <i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#setMiterLimit">setMiterLimit</a></b>(qreal <i>limit</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#setStyle">setStyle</a></b>(Qt::PenStyle <i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#setWidth">setWidth</a></b>(int <i>width</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#setWidthF">setWidthF</a></b>(qreal <i>width</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::PenStyle </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#style">style</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#swap">swap</a></b>(QPen &amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#width">width</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#widthF">widthF</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVariant </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#operator-QVariant">operator QVariant</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#operator-not-eq">operator!=</a></b>(const QPen &amp;<i>pen</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpen.html#operator-eq-eq">operator==</a></b>(const QPen &amp;<i>pen</i>) const</td></tr>
</table></div>
<a name="related-non-members"></a>
<h2 id="related-non-members">Related Non-Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp;</td><td class="memItemRight bottomAlign"><b><a href="qpen.html#operator-lt-lt">operator&lt;&lt;</a></b>(QDataStream &amp;<i>stream</i>, const QPen &amp;<i>pen</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp;</td><td class="memItemRight bottomAlign"><b><a href="qpen.html#operator-gt-gt">operator&gt;&gt;</a></b>(QDataStream &amp;<i>stream</i>, QPen &amp;<i>pen</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QPen-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>A pen has a <a href="qpen.html#style">style</a>(), <a href="qpen.html#width">width</a>(), <a href="qpen.html#brush">brush</a>(), <a href="qpen.html#capStyle">capStyle</a>() and <a href="qpen.html#joinStyle">joinStyle</a>().</p>
<p>The pen style defines the line type. The brush is used to fill strokes generated with the pen. Use the <a href="qbrush.html">QBrush</a> class to specify fill styles. The cap style determines the line end caps that can be drawn using <a href="qpainter.html">QPainter</a>, while the join style describes how joins between two lines are drawn. The pen width can be specified in both integer (<a href="qpen.html#width">width</a>()) and floating point (<a href="qpen.html#widthF">widthF</a>()) precision. A line width of zero indicates a cosmetic pen. This means that the pen width is always drawn one pixel wide, independent of the <a href="qpainter.html#coordinate-transformations">transformation</a> set on the painter.</p>
<p>The various settings can easily be modified using the corresponding <a href="qpen.html#setStyle">setStyle</a>(), <a href="qpen.html#setWidth">setWidth</a>(), <a href="qpen.html#setBrush">setBrush</a>(), <a href="qpen.html#setCapStyle">setCapStyle</a>() and <a href="qpen.html#setJoinStyle">setJoinStyle</a>() functions (note that the painter's pen must be reset when altering the pen's properties).</p>
<p>For example:</p>
<pre class="cpp">

  <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
  <span class="type"><a href="qpen.html#QPen">QPen</a></span> pen(<span class="type">Qt</span><span class="operator">::</span>green<span class="operator">,</span> <span class="number">3</span><span class="operator">,</span> <span class="type">Qt</span><span class="operator">::</span>DashDotLine<span class="operator">,</span> <span class="type">Qt</span><span class="operator">::</span>RoundCap<span class="operator">,</span> <span class="type">Qt</span><span class="operator">::</span>RoundJoin);
  painter<span class="operator">.</span>setPen(pen);

</pre>
<p>which is equivalent to</p>
<pre class="cpp">

  <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
  <span class="type"><a href="qpen.html#QPen">QPen</a></span> pen;  <span class="comment">// creates a default pen</span>

  pen<span class="operator">.</span>setStyle(<span class="type">Qt</span><span class="operator">::</span>DashDotLine);
  pen<span class="operator">.</span>setWidth(<span class="number">3</span>);
  pen<span class="operator">.</span>setBrush(<span class="type">Qt</span><span class="operator">::</span>green);
  pen<span class="operator">.</span>setCapStyle(<span class="type">Qt</span><span class="operator">::</span>RoundCap);
  pen<span class="operator">.</span>setJoinStyle(<span class="type">Qt</span><span class="operator">::</span>RoundJoin);

  painter<span class="operator">.</span>setPen(pen);

</pre>
<p>The default pen is a solid black brush with 1 width, square cap style (<a href="../qtcore/qt.html#PenCapStyle-enum">Qt::SquareCap</a>), and bevel join style (<a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::BevelJoin</a>).</p>
<p>In addition QPen provides the <a href="qpen.html#color">color</a>() and <a href="qpen.html#setColor">setColor</a>() convenience functions to extract and set the color of the pen's brush, respectively. Pens may also be compared and streamed.</p>
<p>For more information about painting in general, see the <a href="paintsystem.html">Paint System</a> documentation.</p>
<a name="pen-style"></a>
<h3 id="pen-style">Pen Style</h3>
<p>Qt provides several built-in styles represented by the <a href="../qtcore/qt.html#PenStyle-enum">Qt::PenStyle</a> enum:</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><img src="images/qpen-solid.png" alt="" /></td><td ><img src="images/qpen-dash.png" alt="" /></td><td ><img src="images/qpen-dot.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><a href="../qtcore/qt.html#PenStyle-enum">Qt::SolidLine</a></td><td ><a href="../qtcore/qt.html#PenStyle-enum">Qt::DashLine</a></td><td ><a href="../qtcore/qt.html#PenStyle-enum">Qt::DotLine</a></td></tr>
<tr valign="top" class="odd"><td ><img src="images/qpen-dashdot.png" alt="" /></td><td ><img src="images/qpen-dashdotdot.png" alt="" /></td><td ><img src="images/qpen-custom.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><a href="../qtcore/qt.html#PenStyle-enum">Qt::DashDotLine</a></td><td ><a href="../qtcore/qt.html#PenStyle-enum">Qt::DashDotDotLine</a></td><td ><a href="../qtcore/qt.html#PenStyle-enum">Qt::CustomDashLine</a></td></tr>
</table></div>
<p>Simply use the <a href="qpen.html#setStyle">setStyle</a>() function to convert the pen style to either of the built-in styles, except the <a href="../qtcore/qt.html#PenStyle-enum">Qt::CustomDashLine</a> style which we will come back to shortly. Setting the style to <a href="../qtcore/qt.html#PenStyle-enum">Qt::NoPen</a> tells the painter to not draw lines or outlines. The default pen style is <a href="../qtcore/qt.html#PenStyle-enum">Qt::SolidLine</a>.</p>
<p>Since Qt 4.1 it is also possible to specify a custom dash pattern using the <a href="qpen.html#setDashPattern">setDashPattern</a>() function which implicitly converts the style of the pen to <a href="../qtcore/qt.html#PenStyle-enum">Qt::CustomDashLine</a>. The pattern argument, a <a href="../qtcore/qvector.html">QVector</a>, must be specified as an even number of <a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a> entries where the entries 1, 3, 5..&#x2e; are the dashes and 2, 4, 6..&#x2e; are the spaces. For example, the custom pattern shown above is created using the following code:</p>
<pre class="cpp">

  <span class="type"><a href="qpen.html#QPen">QPen</a></span> pen;
  <span class="type"><a href="../qtcore/qvector.html">QVector</a></span><span class="operator">&lt;</span><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span><span class="operator">&gt;</span> dashes;
  <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> space <span class="operator">=</span> <span class="number">4</span>;

  dashes <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="number">1</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> space <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="number">3</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> space <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="number">9</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> space
             <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="number">27</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> space <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="number">9</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> space;

  pen<span class="operator">.</span>setDashPattern(dashes);

</pre>
<p>Note that the dash pattern is specified in units of the pens width, e.g&#x2e; a dash of length 5 in width 10 is 50 pixels long.</p>
<p>The currently set dash pattern can be retrieved using the <a href="qpen.html#dashPattern">dashPattern</a>() function. Use the <a href="qpen.html#isSolid">isSolid</a>() function to determine whether the pen has a solid fill, or not.</p>
<a name="cap-style"></a>
<h3 id="cap-style">Cap Style</h3>
<p>The cap style defines how the end points of lines are drawn using <a href="qpainter.html">QPainter</a>. The cap style only apply to wide lines, i.e&#x2e; when the width is 1 or greater. The <a href="../qtcore/qt.html#PenCapStyle-enum">Qt::PenCapStyle</a> enum provides the following styles:</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><img src="images/qpen-square.png" alt="" /></td><td ><img src="images/qpen-flat.png" alt="" /></td><td ><img src="images/qpen-roundcap.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><a href="../qtcore/qt.html#PenCapStyle-enum">Qt::SquareCap</a></td><td ><a href="../qtcore/qt.html#PenCapStyle-enum">Qt::FlatCap</a></td><td ><a href="../qtcore/qt.html#PenCapStyle-enum">Qt::RoundCap</a></td></tr>
</table></div>
<p>The <a href="../qtcore/qt.html#PenCapStyle-enum">Qt::SquareCap</a> style is a square line end that covers the end point and extends beyond it by half the line width. The <a href="../qtcore/qt.html#PenCapStyle-enum">Qt::FlatCap</a> style is a square line end that does not cover the end point of the line. And the <a href="../qtcore/qt.html#PenCapStyle-enum">Qt::RoundCap</a> style is a rounded line end covering the end point.</p>
<p>The default is <a href="../qtcore/qt.html#PenCapStyle-enum">Qt::SquareCap</a>.</p>
<p>Whether or not end points are drawn when the pen width is 0 or 1 depends on the cap style. Using <a href="../qtcore/qt.html#PenCapStyle-enum">Qt::SquareCap</a> or <a href="../qtcore/qt.html#PenCapStyle-enum">Qt::RoundCap</a> they are drawn, using <a href="../qtcore/qt.html#PenCapStyle-enum">Qt::FlatCap</a> they are not drawn.</p>
<a name="join-style"></a>
<h3 id="join-style">Join Style</h3>
<p>The join style defines how joins between two connected lines can be drawn using <a href="qpainter.html">QPainter</a>. The join style only apply to wide lines, i.e&#x2e; when the width is 1 or greater. The <a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::PenJoinStyle</a> enum provides the following styles:</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><img src="images/qpen-bevel.png" alt="" /></td><td ><img src="images/qpen-miter.png" alt="" /></td><td ><img src="images/qpen-roundjoin.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::BevelJoin</a></td><td ><a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::MiterJoin</a></td><td ><a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::RoundJoin</a></td></tr>
</table></div>
<p>The <a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::BevelJoin</a> style fills the triangular notch between the two lines. The <a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::MiterJoin</a> style extends the lines to meet at an angle. And the <a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::RoundJoin</a> style fills a circular arc between the two lines.</p>
<p>The default is <a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::BevelJoin</a>.</p>
<p class="centerAlign"><img src="images/qpen-miterlimit.png" alt="" /></p><p>When the <a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::MiterJoin</a> style is applied, it is possible to use the <a href="qpen.html#setMiterLimit">setMiterLimit</a>() function to specify how far the miter join can extend from the join point. The <a href="qpen.html#miterLimit">miterLimit</a>() is used to reduce artifacts between line joins where the lines are close to parallel.</p>
<p>The <a href="qpen.html#miterLimit">miterLimit</a>() must be specified in units of the pens width, e.g&#x2e; a miter limit of 5 in width 10 is 50 pixels long. The default miter limit is 2, i.e&#x2e; twice the pen width in pixels.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpen-demo.png" alt="" /></td><td ><b><a href="../qtwidgets/qtwidgets-painting-pathstroke-example.html">The Path Stroking Example</a></b><p>The Path Stroking example shows Qt's built-in dash patterns and shows how custom patterns can be used to extend the range of available patterns.</p>
</td></tr>
</table></div>
</div>
<p><b>See also </b><a href="qpainter.html">QPainter</a>, <a href="qbrush.html">QBrush</a>, <a href="../qtwidgets/qtwidgets-painting-pathstroke-example.html">Path Stroking Example</a>, and <a href="../qtwidgets/qtwidgets-widgets-scribble-example.html">Scribble Example</a>.</p>
<!-- @@@QPen -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QPen$$$QPenQPen&& -->
<h3 class="fn" id="QPen-5"><a name="QPen-5"></a>QPen::<span class="name">QPen</span>(<span class="type"><a href="qpen.html#QPen">QPen</a></span> &amp;&amp;<i>pen</i>)</h3>
<p>Constructs a pen that is moved from the given <i>pen</i>.</p>
<p>The moved-from pen can only be assigned to, copied, or destroyed. Any other operation (prior to assignment) leads to undefined behavior.</p>
<p>This function was introduced in Qt 5.4.</p>
<!-- @@@QPen -->
<!-- $$$QPen$$$QPenconstQPen& -->
<h3 class="fn" id="QPen-4"><a name="QPen-4"></a>QPen::<span class="name">QPen</span>(const <span class="type"><a href="qpen.html#QPen">QPen</a></span> &amp;<i>pen</i>)</h3>
<p>Constructs a pen that is a copy of the given <i>pen</i>.</p>
<!-- @@@QPen -->
<!-- $$$QPen$$$QPenconstQBrush&qrealQt::PenStyleQt::PenCapStyleQt::PenJoinStyle -->
<h3 class="fn" id="QPen-3"><a name="QPen-3"></a>QPen::<span class="name">QPen</span>(const <span class="type"><a href="qbrush.html">QBrush</a></span> &amp;<i>brush</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>width</i>, <span class="type"><a href="../qtcore/qt.html#PenStyle-enum">Qt::PenStyle</a></span> <i>style</i> = Qt::SolidLine, <span class="type"><a href="../qtcore/qt.html#PenCapStyle-enum">Qt::PenCapStyle</a></span> <i>cap</i> = Qt::SquareCap, <span class="type"><a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::PenJoinStyle</a></span> <i>join</i> = Qt::BevelJoin)</h3>
<p>Constructs a pen with the specified <i>brush</i>, <i>width</i>, pen <i>style</i>, <i>cap</i> style and <i>join</i> style.</p>
<p><b>See also </b><a href="qpen.html#setBrush">setBrush</a>(), <a href="qpen.html#setWidth">setWidth</a>(), <a href="qpen.html#setStyle">setStyle</a>(), <a href="qpen.html#setCapStyle">setCapStyle</a>(), and <a href="qpen.html#setJoinStyle">setJoinStyle</a>().</p>
<!-- @@@QPen -->
<!-- $$$QPen$$$QPenconstQColor& -->
<h3 class="fn" id="QPen-2"><a name="QPen-2"></a>QPen::<span class="name">QPen</span>(const <span class="type"><a href="qcolor.html">QColor</a></span> &amp;<i>color</i>)</h3>
<p>Constructs a solid line pen with 1 width and the given <i>color</i>.</p>
<p><b>See also </b><a href="qpen.html#setBrush">setBrush</a>() and <a href="qpen.html#setColor">setColor</a>().</p>
<!-- @@@QPen -->
<!-- $$$QPen$$$QPenQt::PenStyle -->
<h3 class="fn" id="QPen-1"><a name="QPen-1"></a>QPen::<span class="name">QPen</span>(<span class="type"><a href="../qtcore/qt.html#PenStyle-enum">Qt::PenStyle</a></span> <i>style</i>)</h3>
<p>Constructs a black pen with 1 width and the given <i>style</i>.</p>
<p><b>See also </b><a href="qpen.html#setStyle">setStyle</a>().</p>
<!-- @@@QPen -->
<!-- $$$QPen[overload1]$$$QPen -->
<h3 class="fn" id="QPen"><a name="QPen"></a>QPen::<span class="name">QPen</span>()</h3>
<p>Constructs a default black solid line pen with 1 width.</p>
<!-- @@@QPen -->
<!-- $$$operator=$$$operator=QPen&& -->
<h3 class="fn" id="operator-eq-1"><a name="operator-eq-1"></a><span class="type"><a href="qpen.html#QPen">QPen</a></span> &amp;QPen::<span class="name">operator=</span>(<span class="type"><a href="qpen.html#QPen">QPen</a></span> &amp;&amp;<i>other</i>)</h3>
<p>Move-assigns <i>other</i> to this <a href="qpen.html">QPen</a> instance.</p>
<p>This function was introduced in Qt 5.2.</p>
<!-- @@@operator= -->
<!-- $$$operator=[overload1]$$$operator=constQPen& -->
<h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qpen.html#QPen">QPen</a></span> &amp;QPen::<span class="name">operator=</span>(const <span class="type"><a href="qpen.html#QPen">QPen</a></span> &amp;<i>pen</i>)</h3>
<p>Assigns the given <i>pen</i> to this pen and returns a reference to this pen.</p>
<!-- @@@operator= -->
<!-- $$$~QPen[overload1]$$$~QPen -->
<h3 class="fn" id="dtor.QPen"><a name="dtor.QPen"></a>QPen::<span class="name">~QPen</span>()</h3>
<p>Destroys the pen.</p>
<!-- @@@~QPen -->
<!-- $$$brush[overload1]$$$brush -->
<h3 class="fn" id="brush"><a name="brush"></a><span class="type"><a href="qbrush.html">QBrush</a></span> QPen::<span class="name">brush</span>() const</h3>
<p>Returns the brush used to fill strokes generated with this pen.</p>
<p><b>See also </b><a href="qpen.html#setBrush">setBrush</a>().</p>
<!-- @@@brush -->
<!-- $$$capStyle[overload1]$$$capStyle -->
<h3 class="fn" id="capStyle"><a name="capStyle"></a><span class="type"><a href="../qtcore/qt.html#PenCapStyle-enum">Qt::PenCapStyle</a></span> QPen::<span class="name">capStyle</span>() const</h3>
<p>Returns the pen's cap style.</p>
<p><b>See also </b><a href="qpen.html#setCapStyle">setCapStyle</a>() and <a href="qpen.html#cap-style">Cap Style</a>.</p>
<!-- @@@capStyle -->
<!-- $$$color[overload1]$$$color -->
<h3 class="fn" id="color"><a name="color"></a><span class="type"><a href="qcolor.html">QColor</a></span> QPen::<span class="name">color</span>() const</h3>
<p>Returns the color of this pen's brush.</p>
<p><b>See also </b><a href="qpen.html#brush">brush</a>() and <a href="qpen.html#setColor">setColor</a>().</p>
<!-- @@@color -->
<!-- $$$dashOffset[overload1]$$$dashOffset -->
<h3 class="fn" id="dashOffset"><a name="dashOffset"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QPen::<span class="name">dashOffset</span>() const</h3>
<p>Returns the dash offset for the pen.</p>
<p><b>See also </b><a href="qpen.html#setDashOffset">setDashOffset</a>().</p>
<!-- @@@dashOffset -->
<!-- $$$dashPattern[overload1]$$$dashPattern -->
<h3 class="fn" id="dashPattern"><a name="dashPattern"></a><span class="type"><a href="../qtcore/qvector.html">QVector</a></span>&lt;<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>&gt; QPen::<span class="name">dashPattern</span>() const</h3>
<p>Returns the dash pattern of this pen.</p>
<p><b>See also </b><a href="qpen.html#setDashPattern">setDashPattern</a>(), <a href="qpen.html#style">style</a>(), and <a href="qpen.html#isSolid">isSolid</a>().</p>
<!-- @@@dashPattern -->
<!-- $$$isCosmetic[overload1]$$$isCosmetic -->
<h3 class="fn" id="isCosmetic"><a name="isCosmetic"></a><span class="type">bool</span> QPen::<span class="name">isCosmetic</span>() const</h3>
<p>Returns <code>true</code> if the pen is cosmetic; otherwise returns <code>false</code>.</p>
<p>Cosmetic pens are used to draw strokes that have a constant width regardless of any transformations applied to the <a href="qpainter.html">QPainter</a> they are used with. Drawing a shape with a cosmetic pen ensures that its outline will have the same thickness at different scale factors.</p>
<p>A zero width pen is cosmetic by default.</p>
<p><b>See also </b><a href="qpen.html#setCosmetic">setCosmetic</a>() and <a href="qpen.html#widthF">widthF</a>().</p>
<!-- @@@isCosmetic -->
<!-- $$$isSolid[overload1]$$$isSolid -->
<h3 class="fn" id="isSolid"><a name="isSolid"></a><span class="type">bool</span> QPen::<span class="name">isSolid</span>() const</h3>
<p>Returns <code>true</code> if the pen has a solid fill, otherwise false.</p>
<p><b>See also </b><a href="qpen.html#style">style</a>() and <a href="qpen.html#dashPattern">dashPattern</a>().</p>
<!-- @@@isSolid -->
<!-- $$$joinStyle[overload1]$$$joinStyle -->
<h3 class="fn" id="joinStyle"><a name="joinStyle"></a><span class="type"><a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::PenJoinStyle</a></span> QPen::<span class="name">joinStyle</span>() const</h3>
<p>Returns the pen's join style.</p>
<p><b>See also </b><a href="qpen.html#setJoinStyle">setJoinStyle</a>() and <a href="qpen.html#join-style">Join Style</a>.</p>
<!-- @@@joinStyle -->
<!-- $$$miterLimit[overload1]$$$miterLimit -->
<h3 class="fn" id="miterLimit"><a name="miterLimit"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QPen::<span class="name">miterLimit</span>() const</h3>
<p>Returns the miter limit of the pen. The miter limit is only relevant when the join style is set to <a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::MiterJoin</a>.</p>
<p><b>See also </b><a href="qpen.html#setMiterLimit">setMiterLimit</a>() and <a href="qpen.html#join-style">Join Style</a>.</p>
<!-- @@@miterLimit -->
<!-- $$$setBrush[overload1]$$$setBrushconstQBrush& -->
<h3 class="fn" id="setBrush"><a name="setBrush"></a><span class="type">void</span> QPen::<span class="name">setBrush</span>(const <span class="type"><a href="qbrush.html">QBrush</a></span> &amp;<i>brush</i>)</h3>
<p>Sets the brush used to fill strokes generated with this pen to the given <i>brush</i>.</p>
<p><b>See also </b><a href="qpen.html#brush">brush</a>() and <a href="qpen.html#setColor">setColor</a>().</p>
<!-- @@@setBrush -->
<!-- $$$setCapStyle[overload1]$$$setCapStyleQt::PenCapStyle -->
<h3 class="fn" id="setCapStyle"><a name="setCapStyle"></a><span class="type">void</span> QPen::<span class="name">setCapStyle</span>(<span class="type"><a href="../qtcore/qt.html#PenCapStyle-enum">Qt::PenCapStyle</a></span> <i>style</i>)</h3>
<p>Sets the pen's cap style to the given <i>style</i>. The default value is <a href="../qtcore/qt.html#PenCapStyle-enum">Qt::SquareCap</a>.</p>
<p><b>See also </b><a href="qpen.html#capStyle">capStyle</a>() and <a href="qpen.html#cap-style">Cap Style</a>.</p>
<!-- @@@setCapStyle -->
<!-- $$$setColor[overload1]$$$setColorconstQColor& -->
<h3 class="fn" id="setColor"><a name="setColor"></a><span class="type">void</span> QPen::<span class="name">setColor</span>(const <span class="type"><a href="qcolor.html">QColor</a></span> &amp;<i>color</i>)</h3>
<p>Sets the color of this pen's brush to the given <i>color</i>.</p>
<p><b>See also </b><a href="qpen.html#setBrush">setBrush</a>() and <a href="qpen.html#color">color</a>().</p>
<!-- @@@setColor -->
<!-- $$$setCosmetic[overload1]$$$setCosmeticbool -->
<h3 class="fn" id="setCosmetic"><a name="setCosmetic"></a><span class="type">void</span> QPen::<span class="name">setCosmetic</span>(<span class="type">bool</span> <i>cosmetic</i>)</h3>
<p>Sets this pen to cosmetic or non-cosmetic, depending on the value of <i>cosmetic</i>.</p>
<p><b>See also </b><a href="qpen.html#isCosmetic">isCosmetic</a>().</p>
<!-- @@@setCosmetic -->
<!-- $$$setDashOffset[overload1]$$$setDashOffsetqreal -->
<h3 class="fn" id="setDashOffset"><a name="setDashOffset"></a><span class="type">void</span> QPen::<span class="name">setDashOffset</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>offset</i>)</h3>
<p>Sets the dash offset (the starting point on the dash pattern) for this pen to the <i>offset</i> specified. The offset is measured in terms of the units used to specify the dash pattern.</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><img src="images/qpen-dashpattern.png" alt="" /></td><td >For example, a pattern where each stroke is four units long, followed by a gap of two units, will begin with the stroke when drawn as a line.<p>However, if the dash offset is set to 4.0, any line drawn will begin with the gap. Values of the offset up to 4.0 will cause part of the stroke to be drawn first, and values of the offset between 4.0 and 6.0 will cause the line to begin with part of the gap.</p>
</td></tr>
</table></div>
<p><b>Note: </b>This implicitly converts the style of the pen to <a href="../qtcore/qt.html#PenStyle-enum">Qt::CustomDashLine</a>.</p><p><b>See also </b><a href="qpen.html#dashOffset">dashOffset</a>().</p>
<!-- @@@setDashOffset -->
<!-- $$$setDashPattern[overload1]$$$setDashPatternconstQVector<qreal>& -->
<h3 class="fn" id="setDashPattern"><a name="setDashPattern"></a><span class="type">void</span> QPen::<span class="name">setDashPattern</span>(const <span class="type"><a href="../qtcore/qvector.html">QVector</a></span>&lt;<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>&gt; &amp;<i>pattern</i>)</h3>
<p>Sets the dash pattern for this pen to the given <i>pattern</i>. This implicitly converts the style of the pen to <a href="../qtcore/qt.html#PenStyle-enum">Qt::CustomDashLine</a>.</p>
<p>The pattern must be specified as an even number of positive entries where the entries 1, 3, 5..&#x2e; are the dashes and 2, 4, 6..&#x2e; are the spaces. For example:</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpen-custom.png" alt="" /></td><td ><pre class="cpp">

  <span class="type"><a href="qpen.html#QPen">QPen</a></span> pen;
  <span class="type"><a href="../qtcore/qvector.html">QVector</a></span><span class="operator">&lt;</span><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span><span class="operator">&gt;</span> dashes;
  <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> space <span class="operator">=</span> <span class="number">4</span>;
  dashes <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="number">1</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> space <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="number">3</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> space <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="number">9</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> space
             <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="number">27</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> space <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="number">9</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> space;
  pen<span class="operator">.</span>setDashPattern(dashes);

</pre>
</td></tr>
</table></div>
<p>The dash pattern is specified in units of the pens width; e.g&#x2e; a dash of length 5 in width 10 is 50 pixels long. Note that a pen with zero width is equivalent to a cosmetic pen with a width of 1 pixel.</p>
<p>Each dash is also subject to cap styles so a dash of 1 with square cap set will extend 0.5 pixels out in each direction resulting in a total width of 2.</p>
<p>Note that the default cap style is <a href="../qtcore/qt.html#PenCapStyle-enum">Qt::SquareCap</a>, meaning that a square line end covers the end point and extends beyond it by half the line width.</p>
<p><b>See also </b><a href="qpen.html#setStyle">setStyle</a>(), <a href="qpen.html#dashPattern">dashPattern</a>(), <a href="qpen.html#setCapStyle">setCapStyle</a>(), and <a href="qpen.html#setCosmetic">setCosmetic</a>().</p>
<!-- @@@setDashPattern -->
<!-- $$$setJoinStyle[overload1]$$$setJoinStyleQt::PenJoinStyle -->
<h3 class="fn" id="setJoinStyle"><a name="setJoinStyle"></a><span class="type">void</span> QPen::<span class="name">setJoinStyle</span>(<span class="type"><a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::PenJoinStyle</a></span> <i>style</i>)</h3>
<p>Sets the pen's join style to the given <i>style</i>. The default value is <a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::BevelJoin</a>.</p>
<p><b>See also </b><a href="qpen.html#joinStyle">joinStyle</a>() and <a href="qpen.html#join-style">Join Style</a>.</p>
<!-- @@@setJoinStyle -->
<!-- $$$setMiterLimit[overload1]$$$setMiterLimitqreal -->
<h3 class="fn" id="setMiterLimit"><a name="setMiterLimit"></a><span class="type">void</span> QPen::<span class="name">setMiterLimit</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>limit</i>)</h3>
<p>Sets the miter limit of this pen to the given <i>limit</i>.</p>
<p class="centerAlign"><img src="images/qpen-miterlimit.png" alt="" /></p><p>The miter limit describes how far a miter join can extend from the join point. This is used to reduce artifacts between line joins where the lines are close to parallel.</p>
<p>This value does only have effect when the pen style is set to <a href="../qtcore/qt.html#PenJoinStyle-enum">Qt::MiterJoin</a>. The value is specified in units of the pen's width, e.g&#x2e; a miter limit of 5 in width 10 is 50 pixels long. The default miter limit is 2, i.e&#x2e; twice the pen width in pixels.</p>
<p><b>See also </b><a href="qpen.html#miterLimit">miterLimit</a>(), <a href="qpen.html#setJoinStyle">setJoinStyle</a>(), and <a href="qpen.html#join-style">Join Style</a>.</p>
<!-- @@@setMiterLimit -->
<!-- $$$setStyle[overload1]$$$setStyleQt::PenStyle -->
<h3 class="fn" id="setStyle"><a name="setStyle"></a><span class="type">void</span> QPen::<span class="name">setStyle</span>(<span class="type"><a href="../qtcore/qt.html#PenStyle-enum">Qt::PenStyle</a></span> <i>style</i>)</h3>
<p>Sets the pen style to the given <i>style</i>.</p>
<p>See the <a href="../qtcore/qt.html#PenStyle-enum">Qt::PenStyle</a> documentation for a list of the available styles. Since Qt 4.1 it is also possible to specify a custom dash pattern using the <a href="qpen.html#setDashPattern">setDashPattern</a>() function which implicitly converts the style of the pen to <a href="../qtcore/qt.html#PenStyle-enum">Qt::CustomDashLine</a>.</p>
<p><b>Note: </b>This function resets the dash offset to zero.</p><p><b>See also </b><a href="qpen.html#style">style</a>() and <a href="qpen.html#pen-style">Pen Style</a>.</p>
<!-- @@@setStyle -->
<!-- $$$setWidth[overload1]$$$setWidthint -->
<h3 class="fn" id="setWidth"><a name="setWidth"></a><span class="type">void</span> QPen::<span class="name">setWidth</span>(<span class="type">int</span> <i>width</i>)</h3>
<p>Sets the pen width to the given <i>width</i> in pixels with integer precision.</p>
<p>A line width of zero indicates a cosmetic pen. This means that the pen width is always drawn one pixel wide, independent of the <a href="qpainter.html#coordinate-transformations">transformation</a> set on the painter.</p>
<p>Setting a pen width with a negative value is not supported.</p>
<p><b>See also </b><a href="qpen.html#setWidthF">setWidthF</a>() and <a href="qpen.html#width">width</a>().</p>
<!-- @@@setWidth -->
<!-- $$$setWidthF[overload1]$$$setWidthFqreal -->
<h3 class="fn" id="setWidthF"><a name="setWidthF"></a><span class="type">void</span> QPen::<span class="name">setWidthF</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>width</i>)</h3>
<p>Sets the pen width to the given <i>width</i> in pixels with floating point precision.</p>
<p>A line width of zero indicates a cosmetic pen. This means that the pen width is always drawn one pixel wide, independent of the <a href="qpainter.html#coordinate-transformations">transformation</a> on the painter.</p>
<p>Setting a pen width with a negative value is not supported.</p>
<p><b>See also </b><a href="qpen.html#setWidth">setWidth</a>() and <a href="qpen.html#widthF">widthF</a>().</p>
<!-- @@@setWidthF -->
<!-- $$$style[overload1]$$$style -->
<h3 class="fn" id="style"><a name="style"></a><span class="type"><a href="../qtcore/qt.html#PenStyle-enum">Qt::PenStyle</a></span> QPen::<span class="name">style</span>() const</h3>
<p>Returns the pen style.</p>
<p><b>See also </b><a href="qpen.html#setStyle">setStyle</a>() and <a href="qpen.html#pen-style">Pen Style</a>.</p>
<!-- @@@style -->
<!-- $$$swap[overload1]$$$swapQPen& -->
<h3 class="fn" id="swap"><a name="swap"></a><span class="type">void</span> QPen::<span class="name">swap</span>(<span class="type"><a href="qpen.html#QPen">QPen</a></span> &amp;<i>other</i>)</h3>
<p>Swaps pen <i>other</i> with this pen. This operation is very fast and never fails.</p>
<p>This function was introduced in Qt 4.8.</p>
<!-- @@@swap -->
<!-- $$$width[overload1]$$$width -->
<h3 class="fn" id="width"><a name="width"></a><span class="type">int</span> QPen::<span class="name">width</span>() const</h3>
<p>Returns the pen width with integer precision.</p>
<p><b>See also </b><a href="qpen.html#setWidth">setWidth</a>() and <a href="qpen.html#widthF">widthF</a>().</p>
<!-- @@@width -->
<!-- $$$widthF[overload1]$$$widthF -->
<h3 class="fn" id="widthF"><a name="widthF"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QPen::<span class="name">widthF</span>() const</h3>
<p>Returns the pen width with floating point precision.</p>
<p><b>See also </b><a href="qpen.html#setWidthF">setWidthF</a>() and <a href="qpen.html#width">width</a>().</p>
<!-- @@@widthF -->
<!-- $$$operator QVariant[overload1]$$$operator QVariant -->
<h3 class="fn" id="operator-QVariant"><a name="operator-QVariant"></a><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QPen::<span class="name">operator QVariant</span>() const</h3>
<p>Returns the pen as a <a href="../qtcore/qvariant.html">QVariant</a>.</p>
<!-- @@@operator QVariant -->
<!-- $$$operator!=[overload1]$$$operator!=constQPen& -->
<h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> QPen::<span class="name">operator!=</span>(const <span class="type"><a href="qpen.html#QPen">QPen</a></span> &amp;<i>pen</i>) const</h3>
<p>Returns <code>true</code> if the pen is different from the given <i>pen</i>; otherwise false. Two pens are different if they have different styles, widths or colors.</p>
<p><b>See also </b><a href="qpen.html#operator-eq-eq">operator==</a>().</p>
<!-- @@@operator!= -->
<!-- $$$operator==[overload1]$$$operator==constQPen& -->
<h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> QPen::<span class="name">operator==</span>(const <span class="type"><a href="qpen.html#QPen">QPen</a></span> &amp;<i>pen</i>) const</h3>
<p>Returns <code>true</code> if the pen is equal to the given <i>pen</i>; otherwise false. Two pens are equal if they have equal styles, widths and colors.</p>
<p><b>See also </b><a href="qpen.html#operator-not-eq">operator!=</a>().</p>
<!-- @@@operator== -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$operator<<[overload1]$$$operator<<QDataStream&constQPen& -->
<h3 class="fn" id="operator-lt-lt"><a name="operator-lt-lt"></a><span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &amp;<span class="name">operator&lt;&lt;</span>(<span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &amp;<i>stream</i>, const <span class="type"><a href="qpen.html#QPen">QPen</a></span> &amp;<i>pen</i>)</h3>
<p>Writes the given <i>pen</i> to the given <i>stream</i> and returns a reference to the <i>stream</i>.</p>
<p><b>See also </b><a href="../qtcore/datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator<< -->
<!-- $$$operator>>[overload1]$$$operator>>QDataStream&QPen& -->
<h3 class="fn" id="operator-gt-gt"><a name="operator-gt-gt"></a><span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &amp;<span class="name">operator&gt;&gt;</span>(<span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &amp;<i>stream</i>, <span class="type"><a href="qpen.html#QPen">QPen</a></span> &amp;<i>pen</i>)</h3>
<p>Reads a pen from the given <i>stream</i> into the given <i>pen</i> and returns a reference to the <i>stream</i>.</p>
<p><b>See also </b><a href="../qtcore/datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator>> -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
